home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 …SCII & the Runetime Code / ADC Developer CD (1992-07) (''Butch ASCII And The Runtime Code'')_iso / Dev.CD 199207.iso / Tools & Apps / Devices & Hardware / A⁄ROSE / FileManager / DemoFile.c next >
Encoding:
C/C++ Source or Header  |  1991-06-18  |  1.9 KB  |  84 lines  |  [TEXT/MPS ]

  1. /********************************************************************************/
  2. /*                                                                                */
  3. /*        FileTest.c - A/ROSE file system test.  (Dynamic Task)                    */
  4. /*                                                                                */
  5. /*        Richard W. Mincher.  December 20, 1989.                                    */
  6. /*                                                                                */
  7. /*        Modified by Anumele D. Raja on June 17, 1991                            */
  8. /*            Changed all the names of file manager calls with A in the front        */
  9. /*                                                                                */
  10. /*        Copyright © 1989-1991 Apple Computer, Inc.  All rights reserved.        */
  11. /*                                                                                */
  12. /********************************************************************************/
  13.  
  14. /*
  15.     This program operates on a file named FS.Test.
  16.     
  17.     First it deletes the file, creates a new file, and opens it.
  18.     Then 1200 bytes are written into this file.
  19.     Next the file is posited at offset 13 and it tries to read 1000 bytes
  20.         in a loop till it gets an EOF error
  21. */
  22.  
  23. #include    "Arose.h"
  24. #include    "Managers.h"
  25.  
  26. #include    "FileTask.h"
  27.  
  28. #define NOISE
  29.     
  30. char    buffer[1001];
  31.  
  32. main()
  33. {    
  34.     unsigned short    ix;
  35.     short    stat;
  36.     long    count;
  37.     short    fid;
  38.     
  39.     stat = AFSDelete( "FS.Test", 0 );
  40. #ifdef    NOISE
  41.     printf("Delete received.  Result = %d\n", stat );
  42. #endif    NOISE
  43.  
  44.     stat = ACreate( "FS.Test", 0, 'MPS ', 'TEXT' );
  45. #ifdef    NOISE
  46.     printf("Create received.  Result = %d\n", stat );
  47. #endif    NOISE
  48.         
  49.     stat = AFSOpen( "FS.Test", 0, &fid );
  50. #ifdef    NOISE
  51.     printf("Open received.  Result = %d\n", stat );
  52. #endif    NOISE
  53.  
  54.     for(ix=0; ix < 100; ix++)
  55.     {
  56.         count = 12;
  57.         stat = AFSWrite( fid, &count, "0123456789A\n" );
  58. #ifdef    NOISE
  59.         printf("Write received.  Result = %d\n", stat );
  60. #endif    NOISE
  61.     }
  62.  
  63.     stat = ASetFPos( fid, 1, 13 );
  64. #ifdef    NOISE
  65.     printf("SetFPos received.  Result = %d\n", stat );
  66. #endif    NOISE
  67.  
  68.  
  69.     stat = 0;
  70.     while(!stat)
  71.     {
  72.         count = 1000;
  73.         stat = AFSRead( fid, &count, buffer );
  74. #ifdef    NOISE
  75.         printf("Read received.  Result = %d  Count = %d\n", stat, count );
  76. #endif    NOISE
  77.     }
  78.  
  79.     stat = AFSClose( fid );
  80. #ifdef    NOISE
  81.     printf("Close received.  Result = %d\n", stat );
  82. #endif    NOISE
  83.     
  84. }